#include <iostream>
using namespace std;
int main()
{
	int x,i,t,g=0;
	int len[1000];
	cin>>x;
	t = x;
	if (x<=100 && x!=1)
	{
		for (i=0;t!=1;i++)
		{
			len[i] = t;
			if (t%2!=0) t = t * 3 + 1;
			else t = t / 2;
		}
		len[i] = 1;
		for (g=i;g>=0;g--)
		{
			cout<<len[g]<<' ';
		}
	}
	else if (t==1) cout<<1<<endl;
	else cout<<"Error!"<<endl;
	return 0;
}
